<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>姓名案例_methods的使用</title>
</head>

<body>
    <!--准备好一个容器-->
    <div id="app">
        姓:<input type="text" v-model="first"><br>
        名：<input type="text" v-model="last"><br>
        姓名：<span>{{fullname()}}</span>
    </div>
    <!--引入vue-->
    <script src="../../vue.js/vue.js"></script>
    <script>
        Vue.config.productionTip=false//阻止vue在启动时候生成生产提示
        var app = new Vue({
            el: "#app",
            data: {
                first:"张",
                last:"三"
            },
            methods: {                                                                                                                                                                                  
                fullname(){
                    return this.first+'-'+this.last;  
                }
            }
        });
    </script>
</body>

</html>